using System.Drawing;
using ComponentFactory.Krypton.Toolkit;
using Nuwanda.TfsSpotlight.Shell.Proxies.Interfaces;

namespace Nuwanda.TfsSpotlight.Shell.Proxies
{
    public class KryptonHeaderProxy : IKryptonHeader
    {
        private readonly KryptonHeader _kryptonHeader;
        private readonly ControlInvoker _headerInvoker;

        public KryptonHeaderProxy(KryptonHeader kryptonHeader)
        {
            this._kryptonHeader = kryptonHeader;
            this._headerInvoker = new ControlInvoker(kryptonHeader);
            Hide();
        }

        public void ShowMessage(string message)
        {
            this._headerInvoker.RunInControlsThread(
                delegate
                    {
                        this._kryptonHeader.Values.Heading = message;
                        this._kryptonHeader.Visible = true;
                    });
        }

        public void Hide()
        {
            this._headerInvoker.RunInControlsThread(
                delegate
                    {
                        this._kryptonHeader.Visible = false;
                    });
        }

        public void ShowMessage(string message, Image image)
        {
            this._headerInvoker.RunInControlsThread(
                 delegate
                 {
                     this._kryptonHeader.Values.Heading = message;
                     this._kryptonHeader.Values.Image = image;
                     this._kryptonHeader.Visible = true;
                 }); 
        }
    }
}